package com.mb.prod.controller;

import com.mb.common.vo.SysResult;
import com.mb.prod.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class IndexController {
    @Autowired
    private IndexService indexService;
    /*
        请求地址:/index/create
        请求参数:String indexName String type
        返回结果:成功失败
     */
    @RequestMapping("/index/create")
    public SysResult indexCreate(String indexName,String type){
        try{
            indexService.indexCreate(indexName,type);
            return SysResult.ok();
        }catch (Exception e){
            e.printStackTrace();
            return SysResult.build(201,"创建索引失败",null);
        }
    }
}
